package com.tencent.iov.cowin.befsale.clue.dao.http.mdquery;

import com.software.boot.common.entity.Response;
import com.tencent.iov.cowin.befsale.clue.dao.http.mdquery.request.*;
import com.tencent.iov.cowin.befsale.clue.dao.http.mdquery.response.*;
import com.tencent.iov.cowin.befsale.clue.value.contants.ServiceConstant;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: whp
 * @description:
 * @createDate: 2021-12-06
 **/

@FeignClient(name = ServiceConstant.SCRM_MD_QUERY_SERVICE,
       url =ServiceConstant.SCRM_MD_QUERY_SERVICE_HOST)
//        url = "http://scrm-dev.scrm-md-query-service.innet.dm.newcowin.com/") //凯翼环境
public interface MdQueryClient {

    String DEALER_URL = "/v1/org/dealer";
    String VEHICLE_BRAND_URL = "/v1/veh/vehicleBrand";
    String VEHICLE_MODEL_URL = "/v1/veh/vehicleModel";
    String VEHICLE_SERIES_URL = "/v1/veh/vehicleSeries";
    String VEHICLE_YEAR_MODEL_URL = "/v1/veh/vehicleYearModel";
    String CUSTOMER_BASE_URL = "/v1/cus/customerBase";
    String CUSTOMER_EMPLOYEE_REL_URL = "/v1/cus/customerEmployeeRel";
    String ORG_EMPLOYEE_URL = "/v1/org/employee";
    String ORG_AREA_URL = "/v1/veh/area";
    String DEALER_SECONDARY_URL = "/v1/org/secondary-dealer";
    String CUS_CERTIFICATEINFO_URL = "/v1/cus/certificateInfo";

    /**
     * 通过ID获取详细信息
     *
     * @param: id
     * @return: Dealer对象
     */
    @ApiOperation(value = "Dealer管理-通过ID获取详细信息接口", httpMethod = "GET", response = Response.class, notes = "get_detail_by_id")
    @RequestMapping(path = DEALER_URL + "/get_detail_by_id", method = RequestMethod.GET)
    Response<DealerResponse> getDetailById(@ApiParam(required = true, value = "对象ID", defaultValue = "1")  @RequestParam("id") Integer id);

    /**
     * 根据条件查询对象对象-单个     *
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "Dealer管理-根据条件查询对象接口", httpMethod = "POST", response = Response.class, notes = "getOneDealerByParam")
    @RequestMapping(path = DEALER_URL + "/getOneDealerByParam", method = RequestMethod.POST)
    Response<DealerResponse> getOneDealerByParam(@RequestBody QueryDealerRequest request, @RequestHeader(value = "tenantId") String tenantId, @RequestHeader(value = "corpId") String corpId);

    @ApiOperation(value = "Dealer管理-根据条件查询对象接口", httpMethod = "POST", response = Response.class, notes = "get_list_by_param")
    @RequestMapping(path = DEALER_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<DealerResponse>> getDealerListByParam(@RequestBody QueryDealerRequest request, @RequestHeader(value = "tenantId") String tenantId, @RequestHeader(value = "corpId") String corpId);

    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleBrand管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = VEHICLE_BRAND_URL + "/get_list_by_param", method = RequestMethod.POST)
    public Response<List<VehicleBrandResponse>> getListByParam(@RequestBody QueryVehicleBrandRequest request);


    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleModel管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = VEHICLE_MODEL_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<VehicleModelResponse>> getListByParam(@RequestBody QueryVehicleModelRequest request);

    /**
     * 根据条件查询对象-单个	 *
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleModel管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "get_one_model_by_param")
    @RequestMapping(path = VEHICLE_MODEL_URL + "/get_one_model_by_param", method = RequestMethod.POST)
    Response<VehicleModelResponse> getOneModelByParam(@RequestBody QueryVehicleModelRequest request);

    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleSeries管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = VEHICLE_SERIES_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<VehicleSeriesResponse>> getVehicleSeriesListByParam(@RequestBody QueryVehicleSeriesRequest request);

    /**
     * 根据条件查询单个车系信息
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "根据条件查询单个车系信息", httpMethod = "POST", response = Response.class, notes = "get_one_series_by_param")
    @RequestMapping(path = VEHICLE_SERIES_URL + "/get_one_series_by_param", method = RequestMethod.POST)
    Response<VehicleSeriesResponse> getOneSeriesByParam(@RequestBody QueryVehicleSeriesRequest request);


    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleYearModel管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = VEHICLE_YEAR_MODEL_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<VehicleYearModelResponse>> getListByParam(@RequestBody QueryVehicleYearModelRequest request);

    /**
     * 根据条件查询对象list列表
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "VehicleYearModel管理-根据条件查询一个对象接口", httpMethod = "POST", response = Response.class, notes = "get_one_by_param")
    @RequestMapping(path = VEHICLE_YEAR_MODEL_URL+"/get_one_by_param", method = RequestMethod.POST)
    Response<VehicleYearModelResponse> getVehYearOneByParam(@RequestBody QueryVehicleYearModelRequest request);


    /**
     * 根据条件查询对象list列表
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "CustomerEmployeeRel管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(value = CUSTOMER_EMPLOYEE_REL_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<CustomerEmployeeRelResponse>> getListByParam(@RequestBody QueryCustomerEmployeeRelRequest request);

    /**
     * 根据条件查询CustomerBase管理,来获取oneid
     *
     * @param request
     * @return 查询结果
     */
    @ApiOperation(value = "CustomerBase管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = CUSTOMER_BASE_URL + "/get_list_by_param", method = RequestMethod.POST)
    public Response<List<CustomerBaseResponse>> getListByParam(@RequestBody QueryCustomerBaseRequest request);


    @ApiOperation(value = "根据手机号查询好友信息及oneId,没有则新增user表")
    @PostMapping(value =  CUSTOMER_BASE_URL +  "/get_customer_base_by_phone")
    public Response<CustomerBaseResponse> getCustomerBaseByPhone(@RequestBody QueryUserRequest request);


    @ApiOperation(value = "根据ids 查询用户信息")
    @PostMapping(value = CUSTOMER_BASE_URL + "/get_customer_by_ids")
    public Response<List<CustomerBaseResponse>> getCustomerByIds(@RequestBody List<String> ids);

    /**
     * add by zly
     * 2022-1-14
     */
    @ApiOperation(value = "Employee管理-根据empIds查询成员信息", httpMethod = "POST", response = Response.class, notes = "getEmployeeByEmpIds")
    @RequestMapping(value = ORG_EMPLOYEE_URL+"/getEmployeeByEmpIds", method = RequestMethod.POST)
    Response<List<EmployeeResponse>> getEmployeeByEmpIds(@RequestBody List<Long> empIds) ;

    /**
     * add by zly
     * 2022-01-21
     * 根据顾问的userId获取顾问的empId
     */
    @ApiOperation(value = "Employee管理-查询成员信息", httpMethod = "GET", response = Response.class, notes = "by_userid")
    @GetMapping(ORG_EMPLOYEE_URL + "/by_userid")
    Response<EmployeeResponse> byEmpByUserid(@RequestParam(value = "userId", required = false) String userId, @RequestHeader(value = "tenantId") String tenantId, @RequestHeader(value = "corpId") String corpId);


    @ApiOperation(value = "Employee管理-通过ID获取详细信息接口", httpMethod = "GET", response = Response.class, notes = "get_detail_by_id")
    @RequestMapping(path = ORG_EMPLOYEE_URL+"/getByIdWithOutRole", method = RequestMethod.GET)
    Response<EmployeeResponse> getByIdWithOutRole(@ApiParam(required = true, value = "对象ID", defaultValue = "1") @RequestParam("id") Long id);

    @ApiOperation(value = "Employee管理-根据dealerId查询经销商对应的所有顾问", httpMethod = "GET", response = Response.class, notes = "query_empIds_by_dealerId")
    @GetMapping(path = ORG_EMPLOYEE_URL+"/query_empIds_by_dealerId")
    Response<List<Long>> queryEmpIdsByDealerId(@RequestParam("dealerId") Integer dealerId) ;
    /**
     * add by zly
     * 根据条件获取省，市，区
     *
     * @param request
     * @return
     */
    @ApiOperation(value = "Area管理-根据条件查询对象接口", httpMethod = "POST", response = Response.class, notes = "get_one_by_param")
    @RequestMapping(path = ORG_AREA_URL + "/get_one_by_param", method = RequestMethod.POST)
    Response<AreaResponse> getOneAreaByParam(@RequestBody QueryAreaRequest request, @RequestHeader(value = "tenantId") String tenantId, @RequestHeader(value = "corpId") String corpId);
    /**
     * 查询二网信息
     * @param id 主键ID
     * @return 二网信息
     */
    @ApiOperation(value = "二网管理_通过ID获取详细信息接口", httpMethod = "POST", response = Response.class, notes = "get_detail_by_id")
    @GetMapping(path = DEALER_SECONDARY_URL + "/get_detail_by_id")
    Response<SecondaryDealerResponse> getSecondaryDealerById(@RequestParam("id") Long id);


    @ApiOperation(value = "二网经销商信息表_通过ID获取详细信息接口", httpMethod = "POST", response = Response.class, notes = "get_secondary_dealer_by_param")
    @RequestMapping(path = DEALER_SECONDARY_URL+"/get_secondary_dealer_by_param", method = RequestMethod.POST)
    Response<List<SecondaryDealerResponse>> getSecondaryDealerByparam(@RequestBody SecondaryDealerRequest request) ;


    @ApiOperation(value = "根据userId 批量查询userName", httpMethod = "POST", response = Response.class)
    @RequestMapping(value = ORG_EMPLOYEE_URL + "/get_user_name_by_user_id", method = RequestMethod.POST)
    Response<List<EmployeeResponse>> getUserNameByUserId(@RequestBody List<String> userIds) ;


    @ApiOperation(value = "Employee管理-通过ID获取详细信息接口", httpMethod = "GET", response = Response.class, notes = "get_detail_by_id")
    @RequestMapping(path = ORG_EMPLOYEE_URL + "/get_detail_by_id", method = RequestMethod.GET)
    Response<EmployeeResponse> getDetailById(@ApiParam(required = true, value = "对象ID", defaultValue = "1") @RequestParam("id") Long id) ;

    @ApiOperation(value = "CertificateInfo管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = CUS_CERTIFICATEINFO_URL + "/get_one_by_param", method = RequestMethod.POST)
    Response<CertificateInfoResponse> getOneByParam(@RequestBody QueryCertificateInfoRequest request) ;

    @ApiOperation(value = "CertificateInfo管理-根据条件查询对象list列表接口", httpMethod = "POST", response = Response.class, notes = "query_list_by_param")
    @RequestMapping(path = CUS_CERTIFICATEINFO_URL + "/get_list_by_param", method = RequestMethod.POST)
    Response<List<CertificateInfoResponse>> getListByParam(@RequestBody QueryCertificateInfoRequest request) ;

}
